﻿

function checkUserExist(fromUserName) {
        $("form").submit(function (e) {
            e.preventDefault();
            $.ajax({
                url: '@Url.Action("CheckUser", "TransferFund")',
                type: 'POST',
                data: { userName: fromUserName},
                success: function (data) {
                    if (!data.ischeck) {
                        $("span").removeClass("field-validation-valid");
                        $("span").addClass("field-validation-error");
                        $("span").text(data.success);
                    } else {
                        $.ajax({
                            url: '@Url.Action("Create", "TransferFund")',
                            type: 'POST',
                            data: {
                                    TransferFundAmount:$("TransferFundAmount").val(),
                                    ToUser:fromUserName,
                                    TransferFundDesc:$("#TransferFundDesc").val()
                            },
                        });
                    }
                },
                error: function () {
                },

            });
        });
}